<?php

namespace App\Contracts;


/**
 * 响应格式化
 *
 * @method ResponseJsonInterface data($value)
 * @method ResponseJsonInterface message($value)
 * @method ResponseJsonInterface code($value)
 */
interface ResponseJsonInterface
{
    public function setResponse($response);

    public function getResponse();

    /**
     * 成功
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function success();

    /**
     * 失败
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function failed();

    /**
     * 错误
     * @param null|\Throwable $exception
     * @return \Psr\Http\Message\ResponseInterface
     */
    public function error($exception = null);
}